﻿using System;
using System.Collections.Generic;

namespace MySoftwareAboutBox
{
    public static class SystemInfoHelper
    {
        public static List<KeyValuePair<string, string>> GetSystemInfo()
        {
            var info = new List<KeyValuePair<string, string>>();

            // 添加各种系统信息
            info.Add(new KeyValuePair<string, string>("操作系统", Environment.OSVersion.ToString()));
            info.Add(new KeyValuePair<string, string>(".NET 版本", Environment.Version.ToString()));
            info.Add(new KeyValuePair<string, string>("系统启动时间", GetSystemUptime()));
            info.Add(new KeyValuePair<string, string>("用户名", Environment.UserName));
            info.Add(new KeyValuePair<string, string>("机器名", Environment.MachineName));
            info.Add(new KeyValuePair<string, string>("处理器数量", Environment.ProcessorCount.ToString()));
            info.Add(new KeyValuePair<string, string>("系统目录", Environment.SystemDirectory));

            // 获取逻辑驱动器
            string[] drives = Environment.GetLogicalDrives();
            info.Add(new KeyValuePair<string, string>("逻辑驱动器", string.Join(", ", drives)));

            return info;
        }

        private static string GetSystemUptime()
        {
            int tickCount = Environment.TickCount;
            TimeSpan uptime = TimeSpan.FromMilliseconds(tickCount);
            return $"{uptime.Days}天 {uptime.Hours}小时 {uptime.Minutes}分钟";
        }

        
    }
}
